package com.knight.study.patterns.tujie.facade;

import java.io.FileWriter;
import java.util.Properties;

/**
 * @Author knight
 * @Date 2024/9/11 17:31
 */

public class PageMaker {
    private PageMaker() {

    }
    public static void makeWelcomePage(String mailadder, String filename) {
        try {
            final Properties mailprop = Database.getProperties("maildata");
            final String username = mailprop.getProperty(mailadder);
            final HtmlWriter writer = new HtmlWriter(new FileWriter(filename));
            writer.titile("Welcome to" + username);
            writer.paragraph(username + "欢迎来到" + username + " 的主页。");
            writer.paragraph("等着你的邮件哦！");
            writer.mailto(mailadder, username);
            writer.close();
            System.out.println(filename + " is created for " + mailadder + " (" + username + ")");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
